package logic

import (
	"context"
	"weixin/moble/mysql"

	"weixin/weixinrpc/internal/svc"
	"weixin/weixinrpc/weixinrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowLogic {
	return &ShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ShowLogic) Show(in *weixinrpc.ShowRequest) (*weixinrpc.ShowResponse, error) {
	// todo: add your logic here and delete this line
	var ioginlogic mysql.Information
	mysql.DB.Debug().Where("id=?", in.Id).Find(&ioginlogic)
	return &weixinrpc.ShowResponse{
		Profile: ioginlogic.Profile,
		Name:    ioginlogic.Name,
		Account: ioginlogic.Account,
		Id:      int64(ioginlogic.ID),
	}, nil
}
